Passed
Push — master ( c59208...8079ea )
by Maxence
02:12
created

admin_pico_result.displayCurrentTemplates   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
nc 2
nop 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A 0 3 1
1
/*
2
 * CMS Pico - Integration of Pico within your files to create websites.
3
 *
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later. See the COPYING file.
6
 *
7
 * @author Maxence Lange <[email protected]>
8
 * @copyright 2017
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
/** global: OC */
27
/** global: OCA */
28
/** global: admin_pico_define */
29
/** global: admin_pico_elements */
30
/** global: admin_pico_nav */
31
32
var admin_pico_result = {
33
34
	displaySettings: function (settings) {
35
		console.log(JSON.stringify(settings));
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
36
		admin_pico_result.displayNewTemplates(settings.templates_new);
37
		admin_pico_result.displayCurrentTemplates(settings.templates);
38
		admin_pico_result.displayNewThemes(settings.themes_new);
39
		admin_pico_result.displayCurrentThemes(settings.themes);
40
	},
41
42
43
	displayNewTemplates: function (templates) {
44
		admin_pico_elements.cms_pico_new_template.empty();
45
		for (var i = 0; i < templates.length; i++) {
46
			admin_pico_elements.cms_pico_new_template.append($('<option>', {
47
				value: templates[i],
48
				text: templates[i]
49
			}));
50
		}
51
	},
52
53
54
	displayCurrentTemplates: function (templates) {
55
		admin_pico_elements.cms_pico_curr_templates.emptyTable();
56
		for (var i = 0; i < templates.length; i++) {
57
			var tmpl = admin_pico_nav.generateTmplCustomTemplate(templates[i]);
58
			admin_pico_elements.cms_pico_curr_templates.append(tmpl);
59
		}
60
61
		admin_pico_elements.cms_pico_curr_templates.children('tr').each(function () {
62
			admin_pico_nav.interactionCurrentTemplate($(this));
63
		});
64
	},
65
66
67
	displayNewThemes: function (themes) {
68
		admin_pico_elements.cms_pico_new_theme.empty();
69
		for (var i = 0; i < themes.length; i++) {
70
			admin_pico_elements.cms_pico_new_theme.append($('<option>', {
71
				value: themes[i],
72
				text: themes[i]
73
			}));
74
		}
75
	},
76
77
78
	displayCurrentThemes: function (templates) {
79
		admin_pico_elements.cms_pico_curr_themes.emptyTable();
80
		for (var i = 0; i < templates.length; i++) {
81
			var tmpl = admin_pico_nav.generateTmplCustomTheme(templates[i]);
82
			admin_pico_elements.cms_pico_curr_themes.append(tmpl);
83
		}
84
85
		admin_pico_elements.cms_pico_curr_themes.children('tr').each(function () {
86
			admin_pico_nav.interactionCurrentTheme($(this));
87
		});
88
	}
89
90
91
};